<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>商品销售统计</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css" media="all">
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<div class="rigtop">
						<span class="title">商品销售统计</span>
					</div>
					<div class="indrig_con orders_con">
						<form id="my_form" action="{:url('count/goods_list')}" method="post">
							<div class="spfl_topbox clearfix">
								<div class="chax_rowbox clearfix">
									<div class="zizh_con_1">
										<div class="shxx_row chax_row clearfix" id='cut_time'>
											<div class="left">销售时间：</div>
											<div class="right clearfix">
												<div class="layui-inline">
													<div class="layui-input-inline">
														<input type="text" class="layui-input" name="begin_time" id="begin_time" value="{$begin_time}" placeholder="yyyy年MM月dd日">
													</div>
												</div>
												<i class="chax_line"></i>
												<div class="layui-inline">
													<div class="layui-input-inline">
														<input type="text" class="layui-input" name="end_time" id="end_time" value="{$end_time}" placeholder="yyyy年MM月dd日">
													</div>
												</div>
											</div>

										</div>
									</div>
								</div>
								<div class="shxx_row clearfix">
									<div class="left" style="margin-left: 5px;">商品编号：</div>
									<div class="right clearfix">
										<input type="text" name="goods_no" id="goods_no" placeholder="输入商品编号" value="{$goods_no}" class="chax_input" />
									</div>
									<div class="left" style="margin-left: 10px;">商品名称：</div>
									<div class="right clearfix">
										<input type="text" name="goods_name" id="goods_name" placeholder="输入商品名称" value="{$goods_name}" class="chax_input" />
									</div>
									<div class="shxx_row clearfix" style="margin-top: -1px;">
										<button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
									</div>
								</div>
							</div>
						</form>

						<div class="chax_xzbtnbox">
							<a href="#" onclick="check()"><i class="iconfont icon-daochu"></i>导出</a>
							<!--<a href="#" onclick="checkmx()"><i class="iconfont icon-daochu"></i>明细导出</a>-->
						</div>

						<div class="orders_content">
							<table class="zizh_table1">
								<thead>
									<tr>
										<th>商品编号</th>
										<th>商品名称</th>
										<th>销量</th>
										<th>金额</th>
										<th>抵扣鼓励金</th>
										<th>库存</th>
									</tr>
								</thead>
								<tbody id="tbody">
									{volist name="goods_list" id="vo" empty="$empty"}
									<tr>
										<td>{$vo.goods_no}</td>
										<td>{$vo.goods_name}</td>
										<td>{$vo.sales}</td>
										<td>{$vo.price?$vo.price : 0}</td>
										<td>{$vo.dk?$vo.dk : 0}</td>
										<td>{$vo.stock}</td>
									</tr>
									{/volist}
								</tbody>
							</table>
							<div class="fenye" style="display: block;">
								{if $goods_list} {$goods_list->render()} {/if}

							</div>

						</div>
					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}
	</body>

</html>
<script type="text/javascript" src="__PUBLIC__/static/js/assist.js"></script>
<script type="text/javascript">
	//调取修改商品页面
	function goods_edit(goods_id) {
		layer.open({
			type: 2,
			title: '发布商品',
			shadeClose: true,
			shade: 0.8,
			area: ['900px', '740px'],
			content: "{:url('shop/goods_edit',['goods_id'=>" + goods_id + "])}"
		});
	}

	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//日期控件
		laydate.render({
			elem: '#begin_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});

		laydate.render({
			elem: '#end_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});
	})

	//商品分类
	$('#to_goods_tpe').click(function() {
		location.href = "goods_type.html";
	})

	//时间区间
	function check_time() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		if(begin_time.length > 2 || end_time.length > 2) {

			if(begin_time.length < 2 || end_time.length < 2) {
				layer.msg("请输入查询时间区间");
				return false;
			}

		}
	}

	function check() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		var goods_no = $('#goods_no').val();
		var goods_name = $('#goods_name').val();
		var type_id = $('#type_id').val();
		var order = $('#order').val();
		window.location.href = "/agent/count/detail_spdc.html?begin_time=" + begin_time + "&end_time=" + end_time + "&goods_no=" + goods_no +
			"&goods_name=" + goods_name;
	}

	function checkmx() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		var goods_no = $('#goods_no').val();
		var goods_name = $('#goods_name').val();
		var type_id = $('#type_id').val();
		var order = $('#order').val();
		window.location.href = "/agent/count/detail_mxdc.html?begin_time=" + begin_time + "&end_time=" + end_time + "&goods_no=" + goods_no +
			"&goods_name=" + goods_name + "&type_id=" + type_id + "&order=" + order;
	}
</script>